package com.cmse.service.impl;

import java.util.List;

import com.cmse.persistence.dao.IArticalCommentDao;
import com.cmse.persistence.domain.ArticalComment;
import com.cmse.persistence.enmu.FetchOrderType;
import com.cmse.service.IArticalCommentService;

/**
 * @author wulibin, exceptsky@gmail.com, 2012-3-15 下午4:45:32
 * 
 */
public class ArticalCommentService extends BaseService<ArticalComment> implements IArticalCommentService{
	private IArticalCommentDao commentDao;

	@Override
	public long getCountOfUnVerified() {
		ArticalComment expComment = new ArticalComment();
		expComment.setVerified(false);
		return commentDao.getCountByCondition(expComment);
	}

	@Override
	public long getCountOfVerified() {
		ArticalComment expComment = new ArticalComment();
		expComment.setVerified(true);
		return commentDao.getCountByCondition(expComment);
	}


	@Override
	public List<ArticalComment> getUnVerified(int page) {
		ArticalComment expComment = new ArticalComment();
		expComment.setVerified(false);
		return commentDao.getByCondition(expComment, page*pageLength, pageLength, FetchOrderType.CREATE_DESC);
	}

	@Override
	public List<ArticalComment> getVerified(int page) {
		ArticalComment expComment = new ArticalComment();
		expComment.setVerified(true);
		return commentDao.getByCondition(expComment, page*pageLength, pageLength, FetchOrderType.CREATE_DESC);
	}

	public void setCommentDao(IArticalCommentDao commentDao) {
		this.commentDao = commentDao;
		this.setDao(commentDao);
	}
}
